<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <!-- 遍历的过程中没有使用索引值 -->
    <ul>
      <li v-for="item in names">{{item}}</li>
    </ul>

    <!-- 使用索引值遍历 -->
    <ul>
      <li v-for="(item, index) in names" :key="index">{{index+1}} {{item}}</li>
    </ul>


    <!-- 遍历的过程中没有使用索引值   默认获取的是值value-->
    <ul>
      <li v-for="value in info">{{value}}</li>
    </ul>
    <!-- 遍历对象中使用索引值 -->
    <ul>
      <li v-for="(value, key) in info" :key="index">{{key}} :{{value}}</li>
    </ul>

    <ul>
      <li v-for="(value, key,index) in info" :key="index">{{key}} :{{value}} {{index}}</li>
    </ul>
  </div>
  <script src="../js/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        names: ['yuhao','xionfeyan','yuyuyu','uuu'],//数组
        info: {                                     //对象
          name: 'yuhao',
          age: 12,
          height: 188
        }
      }
    })
  </script>
</body>
</html>